package com.service;

import com.mapper.CourseMapper;
import com.pojo.Course;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CourseServiceImpl implements CourseService{

    @Autowired
    private CourseMapper courseMapper;

//    显示全部
    public List<Course> showCourseList() {
        List<Course> list = courseMapper.showCourseList();
        return list;
    }
//      模糊查询
    public List<Course> findCourseStyleCname(String cName, String fukuan) {
        List<Course> cname = courseMapper.findCourseStyleCname(cName, fukuan);
        return cname;
    }

//    查单个
    public Course findCourseStyleById(Integer cId) {
        Course byId = courseMapper.findCourseStyleById(cId);
        return byId;
    }
//   增加
    public boolean addCourse(Course course) {
        if(courseMapper.addCourse(course)>0){
            return true;
        }
        return false;
    }

//    修改
    public boolean updateCourse(Course course) {
       if( courseMapper.updateCourse(course)>0){
           return true;
       }
        return false;
    }


//      删除
    public boolean deleteCourse(Integer cId) {
        if(courseMapper.deleteCourse(cId)>0){
            return true;
        }
        return false;
    }
}
